<template>
    <page-main :title="title" title-icon="dashboard">
        <div slot="title-other-content" class="task-title-checkbox">
            <el-checkbox-group v-model="checkList">
                <el-checkbox label="进行"/>
                <el-checkbox label="结束"/>
            </el-checkbox-group>
        </div>
        <el-row :gutter="20">
            <el-col v-for="(item,index) in taskList" :key="index+1" :lg="6" :md="8" :sm="12">
                <el-card shadow="hover" class="task-card">
                    <router-link :to="'/myWork/task/detail?id='+item.id">
                        <div class="task-card-item" @click="$router.push('/myWork/task/detail?id='+item.id )">
                            <h2>{{ item.title }}</h2>
                            <div class="text-grey">
                                {{ item.group }}组
                            </div>
                            <div class="text-grey">
                                组长：{{ item.groupLeader }}
                            </div>
                            <el-row :gutter="8">
                                <el-col v-for="(data,dataIndex) in item.groupMember" :key="dataIndex+1" :span="12">
                                    组员：{{ data }}
                                </el-col>
                            </el-row>
                            <div class="task-card-item-time">
                                截至时间：{{ item.endTime }}
                            </div>
                        </div>
                        <div class="task-card-actions">
                            <div class="card-actions-left flex flex-direction">
                                <button :class="'bg-'+btnClass[0]">9</button>
                                <span class="text-dark">已批改</span>
                            </div>
                            <div class="card-actions-right flex flex-direction">
                                <button class="button-right" :class="'bg-'+btnClass[1]">12</button>
                                <span class="text-dark">未批改</span>
                            </div>
                        </div>
                    </router-link>
                </el-card>
            </el-col>
        </el-row>
        <el-pagination
            background
            layout="prev, pager, next"
            :total="1000"
        />
    </page-main>
</template>

<script>
import PageMain from '@/components/PageMain'

export default {
    name: 'WorkTaskList',
    components: {PageMain},
    props: {
        title: {
            type: String,
            default: ''
        },
        taskList: {
            type: Array,
            default: () => {
                return []
            }
        },
        btnClass: {
            type: Array,
            default: () => {
                return ['green', 'red']
            }
        }
    },
    data() {
        return {
            checkList: []
        }
    }
}
</script>

<style scoped lang="scss">
.task-card {
    margin-bottom: 20px;
    .task-card-item {
        text-align: center;
        font-size: 14px;
        .text-grey {
            margin-bottom: 10px;
        }
        h2 {
            font-weight: bold;
        }
        .task-card-item-time {
            margin-top: 10px;
        }
    }
    .task-card-actions {
        display: flex;
        justify-content: space-around;
        margin: 25px -20px -20px;
        margin-bottom: 2px;
        .card-actions-left,
        .card-actions-right {
            width: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            button {
                display: flex;
                justify-content: center;
                align-items: center;
                color: #fff;
                width: 80%;
                height: 32px;
                border: none;
                border-radius: 5px;
                cursor: pointer;
            }
            span {
                font-size: 12px;
                margin-top: 10px;
            }
        }
    }
}
</style>
